<template>
	<view class="content">

		<view class="text-area">
			<image class="logo" src="../../static/image/mami.png"></image><input type="text" v-model="passworda"
				placeholder="请输入旧密码" />

		</view>
		<view class="text-area">
			<image class="logo" src="../../static/image/mami.png"></image><input type="text" v-model="passwordb"
				placeholder="请输入新密码" />
		         


		</view>
		<view class="text-area">
			<image class="logo"    src="../../static/image/mami.png"></image><input type="text" v-model="passwordc"  
				placeholder="请再次输入新密码" />
		</view>
		<text>{{text}}</text>
		<button type="default" @click="xiugai">登录</button>
	</view>
</template>

<script>
	import {
		ref,
		computed,
		reactive,
		toRefs
	} from 'vue'
	import {
		mapState
	} from 'vuex'
	import ComponentA from '../useradmin/useradmin.vue'
import http from '../../utils/http.js'
	export default {
		setup() {
			let data = reactive({
				passworda: '',
				passwordb: '',
				passwordc: '',
				text: '',
				xiugai() {	
					
				if (JSON.parse(  uni.getStorageSync('user')).u_password ==data.passworda) {
			
				if( data.passworda==data.passwordb  ){
					data.text = '新密码不能于原密码相同'
				} else{
					
					if( data.passwordb==data.passwordc  ){
						
					http({
						url: "/login/xiugai",
						method: "get",
						data: {
							password: data.passwordc  ,
							id:JSON.parse(  uni.getStorageSync('user')).u_id
						}
									
					}).then((res) => {
				
						if( res.data.code==200){
						  uni.removeStorageSync('user')	
						  ;
						  data.passworda= '',
						 data.passwordb= '',
						  data.passwordc= '',
						  uni.navigateTo({
						  	url:'/pages/login/login'
						  })
						}
					
						
					})
						
					}else{
							data.text = '新密码不相同'
					}
					
					
				}
				
				
				
				}else{
					data.text = '原密码输入错误'
				}

				}

			});
			return {
				...toRefs(data)
			};
		},

		onLoad() {

		},
		methods: {

		},
		components: {
			ComponentA
		}
	}
</script>

<style lang="less">
	.logo1{
		height: 30rpx;
		width: 30rpx;
		margin: 20rpx;
		vertical-align: middle;
		
	}
	.logo {
		height: 40rpx;
		width: 40rpx;
		margin: 20rpx;
		vertical-align: middle;
	}

	.text-area {
		margin: 20rpx 150rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: center;
		border-bottom: 1px solid #000000;
	}
.text-arear {
		margin: 20rpx 150rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: center;
	
	}
	.content {
		margin: 350rpx 0rpx;
	}

	.content input {
		height: 50rpx;
		width: 350rpx;
		margin: 20rpx;
	}

	.content button {
		margin-top: 120rpx !important;
		margin: auto;
		width: 440rpx;
		height: 70rpx;
		border-radius: 25rpx;
		line-height: 70rpx;
		font-size: 25rpx;
		color: #FFFFFF !important;
		background-color: #01b5c9 !important;
	}
</style>
